-
Notifications
You must be signed in to change notification settings - Fork 842
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[EUI Datagrid] Adds rowHeightOptions property #4853
Conversation
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
EDIT: comment at #4853 (comment) supersedes this
Looks like a great PoC, thank you for exploring! I'm kinda surprised how straight forward it was to get to even this point. Things we'll need to consider/answer to move forward:
computedStylesForGridCell
is called any time EuiDataGrid renders, and outside any lifecyclegetNumberFromPx
- we'll likely want to try to support non-px values- Would be great to avoid the extra div in data_grid_cell , and is there a way to extend browser support of this method beyond chrome/webkit?
defaultHeight
conflicts with the density setting, though this is probably fine as-is
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
think cells should vertically align top, shouldn't they? @chandlerprall
Spoke with @elastic/kibana-app, let's change the line height configuration to accept either a pixel value or the desired line count. This should remove the need for computing the style & doing other calculations. We want to support:
For the API, I envision something like:
|
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cell actions' appearance/creation shifts content
datagrid_height_truncation.mov
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@chandlerprall
Not 100% sure of it, but shouldn't also the expansion (+ custom cell actions) be vertical aligned top? Would subjectively look better when there's e.g. a single line text displayed next to a multi line cell
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
Yep! I didn't call it out as you already had, and it was part of the our discussion last week. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- datagrid_example.js needs to include
EuiDataGridRowHeightsOptions
in the Props list:- include
EuiDataGridRowHeightsOptions
in the import on lines 21-35 - pass
EuiDataGridRowHeightsOptions
to the props object on lines 365-382
- include
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taking this out of draft, asking @miukimiu for a review on the SCSS changes
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, @VladLasitsa for helping with this. It looks great! 🎉
I tested in Chrome, Safari, Edge, and Firefox and it works as expected. I just noticed a few things that are not blockers but you can definitely improve the code/examples.
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🚀 I pushed a changelog conflict resolution & removed the AtLeastOne
utility type from common.ts as it's no longer used. Everything looks good, I'll merge when CI passes.
Preview documentation changes for this PR: https://eui.elastic.co/pr_4853/ |
Summary
Adds possibility to set default Height for all rows and define initial heights for each row. ALso so that content will be expanded by row height we should provide
rowHeightsOptions
property for datagrid.API:
For example here I set default height for each row = 60 and for second row lineCount = 5
Issues which we have:
shouldComponentUpdate
(https://github.com/elastic/eui/pull/4853/files#diff-9d40afa057c929171c16c51ab0a6c842bea939f4328129246a2f2e772257c3bbR301-R310)rowMap
for every sort relative to the first position of the elements.